﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;

namespace SGCG.Model
{
    public class Group : GroupBase
    {
        public Group(GraphicObject parent, IEnumerable<GraphicObject> graphicObjects)
            : base(parent, graphicObjects) 
        { }

        public override GraphicObject CreateCopy()
        {
            var newObjects = this.rawGraphicObjects.Select(g => g.CreateCopy()).ToList();
            Group group = new Group(null, newObjects);
            newObjects.Each(g => g.Parent = group);
            group.CurrentTransforms = new ObservableCollection<ITransform>(CurrentTransforms);
            group.Attach(this.DrawingCanvas);
            return group;
        }
    }
}
